//
//  HBBaseTabBarController.m
//  HeartBeat
//
//  Created by karong on 2023/8/23.
//

#import "HBBaseTabBarController.h"
#import "HBBaseTabBar.h"
#import "HBFollowController.h"
#import "HBDiscoverController.h"
#import "HBMeController.h"
#import "ViewController.h"

@interface HBBaseTabBarController () <UITabBarControllerDelegate>
@property (nonatomic, strong) HBBaseTabBar *customTabBar;
@property (nonatomic, assign) NSInteger selectIndex;
@end

@implementation HBBaseTabBarController
- (void)viewDidLoad {
    [super viewDidLoad];
    self.delegate = self;
    HBBaseTabBar *tabBar = [[HBBaseTabBar alloc]init];
    self.customTabBar = tabBar;
    self.customTabBar.delegate = self;
    [self setValue:tabBar forKey:@"tabBar"];
    NSMutableArray * controllers = [NSMutableArray new];
    
    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Follow" bundle:nil];
    HBFollowController *followController = [storyBoard instantiateInitialViewController];
    HBBaseNavigationController * followNav = [[HBBaseNavigationController alloc]initWithRootViewController:followController];
    followNav.navigationBarHidden = YES;
    [controllers addObject:followNav];
    
    storyBoard = [UIStoryboard storyboardWithName:@"Discover" bundle:nil];
    HBDiscoverController *discoverController = [storyBoard instantiateInitialViewController];
    HBBaseNavigationController * discoverNav = [[HBBaseNavigationController alloc]initWithRootViewController:discoverController];
    discoverNav.navigationBarHidden = YES;
    [controllers addObject:discoverNav];
    
    storyBoard = [UIStoryboard storyboardWithName:@"Me" bundle:nil];
    HBMeController *meController = [storyBoard instantiateInitialViewController];
    HBBaseNavigationController * meNav = [[HBBaseNavigationController alloc]initWithRootViewController:meController];
    meNav.navigationBarHidden = YES;
    [controllers addObject:meNav];
    [self setViewControllers:controllers];
    self.selectedIndex = 1;
}

@end
